package com.cloud.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EventController {
    @Autowired
    private ApplicationContext applicationContext;

    @RequestMapping("/event/sendEvent")
    public String sendEvent() {
        MsgEvent event =
                new MsgEvent(this, "18140668851", "644064@qq.com",
                        "wx123456", "dingDing123456");
        applicationContext.publishEvent(event);
        // 群发给我们每个观察者
        return "ok";
    }
}
